﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace DAL
{
    public class tbHoaDon
    {
        private int sohd;

        public int Sohd
        {
            get { return sohd; }
            set { sohd = value; }
        }
        private string makh;

        public string Makh
        {
            get { return makh; }
            set { makh = value; }
        }
        private string ngaylap;

        public string Ngaylap
        {
            get { return ngaylap; }
            set { ngaylap = value; }
        }
        private int tinhtrang;

        public int Tinhtrang
        {
            get { return tinhtrang; }
            set { tinhtrang = value; }
        }
        private string ghichu;

        public string Ghichu
        {
            get { return ghichu; }
            set { ghichu = value; }
        }
        private long tongtien;

        public long Tongtien
        {
            get { return tongtien; }
            set { tongtien = value; }
        }

        private string ngaybd;

        public string Ngaybd
        {
            get { return ngaybd; }
            set { ngaybd = value; }
        }
        private string ngaykt;

        public string Ngaykt
        {
            get { return ngaykt; }
            set { ngaykt = value; }
        }

        DBAccess db = new DBAccess();
        public DataTable dalHienThiDDDaGiao()
        {
            string query = "HienThiDDDaGiao";
            SqlParameter[] param = new SqlParameter[0];
            return db.GetDataTable(query, CommandType.StoredProcedure, param);
        }

        public DataTable dalHienTTDDDaGiao()
        {
            string query = "HienThiTTDDDaGiao";
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@SoHD", Sohd);
            return db.GetDataTable(query, CommandType.StoredProcedure, param);
        }

        public DataTable dalHienThiDDChuaGiao()
        {
            string query = "HienThiDDChuaGiao";
            SqlParameter[] param = new SqlParameter[0];
            return db.GetDataTable(query, CommandType.StoredProcedure, param);
        }

        public DataTable dalHienThiTTDDChuaGiao()
        {
            string query = "HienThiTTDDChuaGiao";
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@SoHD", Sohd);
            return db.GetDataTable(query, CommandType.StoredProcedure, param);
        }

        public DataTable dalTKMatHangBan()
        {
            string query = "TKMatHangBan";
            SqlParameter[] param = new SqlParameter[2];
            param[0] = new SqlParameter("@NgayBD", Ngaybd);
            param[1] = new SqlParameter("@NgayKT", Ngaykt);
            return db.GetDataTable(query, CommandType.StoredProcedure, param);
        }

        public bool dalSuaHD()
        {
            bool res=false;
            string query = "SuaHD";
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@SoHD", Sohd);
            res = db.DoExcecute(query, CommandType.StoredProcedure, param);
            return res;

        }
    }
}
